
(function () {
    // 玩家性别类型
    window.SexType = {
        unknown: -1,
        male: 0,
        famale: 1,
    };

    // 普通用户数据
    window.Player = cc.Class({
        properties: {
            nickname: "",
            openid: "",
            unionid: "",
            headimgurl: "",
            sex: SexType.unknown,
            country: ""
        },
        ctor: function () {
            var data = argumentsToObject(arguments);
            this.nickname = data.nickname || "unknown";
            this.openid = data.openid || "unknown";
            this.unionid = data.unionid || "unknown";
            this.headimgurl = data.headimgurl || "res/defaulthead";
            this.sex = data.sex || SexType.male;
            this.country = data.country || "unknown";
        }
    });

    // 玩家状态
    window.PlayerState = {
        waiting: 0,     // 等待、中途加入、单局游戏结束
        needPrepare: 1, // 需要准备、倒计时阶段
        prepare: 2,     // 已准备
        ongoing: 3      // 正在游戏
    };

    // 游戏中玩家数据
    window.GamePlayer = Player.extend({
        extends: Player,
        properties: {
            pos: -1,
            playerState: PlayerState.waiting,
        },
        ctor: function () {
            var data = argumentsToObject(arguments);
            this.pos = data.pos || -1;
            this.playerState = data.playerState || PlayerState.waiting;
        }
    });
})();